package com.spring.arch.operation.tenant.model;

import com.spring.arch.common.jpa.model.AbstractAuditableModel;
import com.spring.arch.common.jpa.model.AbstractAuditableModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.*;

/**
 * 租客联系人
 * @author Frank
 * @version 1.0.0
 * @since 2020/3/23
 */
@NoArgsConstructor
@Getter
@Setter
@Entity
@Table(name = "tenant_lessee_contact")
public class LesseeContact extends AbstractAuditableModel {
    private static final long serialVersionUID = 8702526908840444641L;

    /**
     * 所属客户
     */
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    private Lessee lessee;

    /**
     * 姓名
     */
    @NotBlank
    @Size(max = 64)
    @Column(nullable = false)
    private String name;

    /**
     * 身份证号码
     */
    @NotBlank
    @Size(max = 32)
    @Column(nullable = false)
    private String idCard;

    /**
     * 手机号码
     */
    @Size(max = 11)
    @Pattern(regexp = "^(1[3-9])\\d{9}$", message = "手机号码格式错误")
    private String mobilePhoneNumber;

    /**
     * 邮箱地址
     */
    @Email
    @Size(max = 64)
    private String mailAddress;

    /**
     * 通讯地址
     */
    @Size(max = 128)
    private String postalAddress;

    /**
     * 是否默认联系人
     */
    @NotNull
    private boolean defaultContact;
}
